package com.hst.capacity.infra.convertor;

import com.hst.capacity.domain.model.entity.franchisee.FleetEntity;
import com.hst.capacity.domain.model.entity.franchisee.fleet.FleetUserEntity;
import com.hst.capacity.domain.model.entity.setting.commision.FleetCommisionEntity;
import com.hst.capacity.domain.model.request.fleet.FleetCommisionSaveParam;
import com.hst.capacity.domain.model.request.fleet.FleetSaveParam;
import com.hst.capacity.domain.model.request.fleet.FleetUserSaveParam;
import com.hst.capacity.domain.model.response.fleet.FleetCommisionSelectVO;
import com.hst.capacity.domain.model.response.fleet.FleetSearchVO;
import com.hst.capacity.domain.model.response.fleet.FleetUserSearchVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface FleetConvertor {

    FleetConvertor INSTANCE = Mappers.getMapper(FleetConvertor.class);

    FleetSearchVO convertSelect(FleetEntity fleetEntity);

    void convert(@MappingTarget FleetEntity fleetEntity, FleetSaveParam param);

    FleetCommisionSelectVO convert(FleetCommisionEntity entity);

    FleetUserEntity convert2Entity(FleetUserSaveParam param);

    @Mapping(target="lastLoginTime", dateFormat="yyyy-MM-dd HH:mm")
    FleetUserSearchVO convert2VO(FleetUserEntity entity);

    @Mapping(target="lastLoginTime", dateFormat="yyyy-MM-dd HH:mm")
    List<FleetUserSearchVO> convert2LstVO(List<FleetUserEntity> entity);

    FleetCommisionSaveParam convertSaveSelect(FleetCommisionEntity entity);

    void covert(@MappingTarget FleetCommisionEntity entity, FleetCommisionSaveParam param);

}
